########################################################################
# PLACE LIST CREATIONS HERE #
########################################################################
########################################################################
# PLACE ALL OTHER CODE BELOW THIS #
########################################################################
t = codesters.Teacher()
comments = t.find_text('ALL OTHER', True)
stages = t.find_text('stage_list')
try:
tval0 = int(comments[0][0])
except:
tval0 = 0.0
try:
tval1 = stage_list
tval2 = stages[0][1].count(',')
tval3 = len(stage_list)
tval4 = int(stages[0][0])
except:
tval1 = "DNE"
tval2 = "DNE"
tval3 = "DNE"
tval4 = 0.0
try:
tval5 = my_list
except:
tval5 = "DNE"
t1 = TestObjective()
t1.add_success('moon' in tval1 and 'mars' in tval1 and 'jupiter' in tval1 and tval2 == 2 and tval4 < tval0, "Great job!")
t1.add_failure(type(tval0) == float, "Don't delete the comments!")
t1.add_failure(tval0 < tval4, "Make sure to place the list in the first section of the code!")
t1.add_failure(tval1 == "DNE" and tval5 == "DNE", "Did you create a list named stage_list?")
t1.add_failure(tval1 == "DNE" and tval5 != "DNE", "Did you rename the list stage_list?")
t1.add_failure('cat' in tval1 or 'dog' in tval1 or 'pig' in tval1, "Did you change the three values in the list?")
t1.add_failure('moon' not in tval1 or 'mars' not in tval1 or 'jupiter' not in tval1, "Did you change the three values in the list correctly?")
t1.add_failure(tval3 < 3, "Make sure your list has three values.")
t1.add_failure(tval2 < 2, "Oops! Make sure you have commas between the values in your list.")
t1.add_failure(tval3 > 3, "Did you add extra values to your list?")
tester = TestManager()
tester.add_test_list([t1])
tester.run_tests()
tester.display_first_feedback()
-
Run Code
-
Activity Submitted!
Submit Work
-
Next Activity
-
Stop Running Code
-
Show Chart
-
Show Console
-
Reset Code Editor
-
Codesters How To (opens in a new tab)